package xin.xihc.jba.demo;

import xin.xihc.jba.annotation.Column;
import xin.xihc.jba.annotation.Column.Policy;
import xin.xihc.jba.annotation.Index;
import xin.xihc.jba.annotation.OnUpdateCurrentTimestamp;

import java.util.Date;

/**
 * 最顶层数据库表对象
 *
 * @author Leo.Xi
 * @date 2018年1月22日
 * @since 0.0.1
 */
public abstract class ABaseModel {

    @Column(primary = true, policy = Policy.AUTO, remark = "自增主键")
    protected Long cid;
    @Column(notNull = true, policy = Policy.GUID, length = 32, remark = "GUID主键")
    @Index(type = Index.IndexType.Unique)
    protected String id;
    @Column(notNull = true, remark = "创建时间戳", precision = 3, defaultValue = "CURRENT_TIMESTAMP(3)", order = 999)
    @Index
    protected Date createTime;
    @OnUpdateCurrentTimestamp
    @Column(notNull = true, remark = "更新时间戳", precision = 3, defaultValue = "CURRENT_TIMESTAMP(3)", order = 999)
    protected Date updateTime;
    @Column(remark = "备注", length = 256, order = 999)
    protected String remark;
    @Column(remark = "用于控制高并发的版本号", defaultValue = "0", notNull = true, order = 999)
    protected Integer version;

    public Long getCid() {
        return cid;
    }

    public void setCid(Long cid) {
        this.cid = cid;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

}
